<!doctype html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<title>promise demo</title>
		<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
	</head>

	<body>
		<div></div>
		<script>
			function getJSON(url, fn, opt){
				$.getJSON(url,function(Data){
					this._opt = opt;
					var v = fn.call(this, Data);
					console.info(v);
					console.info(opt);
					//fn(Data);
				})
			}
			
			getJSON('stu.json',function(Data){
				console.warn(this);
				console.warn(Data);
			},"xxx")
			/*forEach实现原理*/
			/*forEach = function(ary, fn) {
				for(var i = 0, l = ary.length; i < l; i++) {
					var c = ary[i];
					if(fn.call(c, i, c) === false) {
						return false;
					}
				}
			}
			
			forEach(["xxx","yyyyy","zzzz"], function(index,el){
				console.log(this);
				console.log(index);
				console.log(el);
			})*/
			
			
		</script>

	</body>

</html>